from langchain.memory import ConversationBufferMemory
from langchain_core.messages import messages_to_dict

def test_save_context():
    inputs = {"user_input_1": "hello"}
    outputs = {"ai_output_1": "AI hello"}
    chatbot = ConversationBufferMemory(input_key="user_input_1", output_key="ai_output_1")
    chatbot.save_context(inputs, outputs)
    print(messages_to_dict(chatbot.chat_memory.messages))
test_save_context()